package com.zhanghe.wzq;

import lombok.Data;

import java.util.Set;

/**
 * Table
 *
 * @author Clevo
 * @date 2018/12/15
 */
@Data
public class Table implements Comparable<Table>{

    public String id;

    public Set<String> users;
    /**
     * 正在进行的游戏
     */
    public Game game;

    /**
     * 获取本桌的另一个用户
     * @param userId
     * @return
     */
    public String getAnotherUserId(String userId){
        for(String user:users){
            if(!user.equals(userId)){
                return user;
            }
        }
        return null;
    }

    public int compareTo(Table o) {
        return this.getId().compareTo(o.getId());
    }
}
